package com.shudingke.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice("com.shudingke.controller")
public class GlobalException {
    
    //@ResponseBody  异步调用
    @ExceptionHandler //同步调用
    public String getException(Exception e){
        e.printStackTrace();//打印错误信息
        
        return "404";
    }


    @ResponseBody  //异步调用
    public String getException2(Exception e){
        e.printStackTrace();//打印错误信息

        return "500";
    }
}
